﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace SevenInvaders.MENU
{
    class Menu
    {
        Button buttonGabe;
        Button buttonDiehl;
        Button buttonAdilio;
        Button buttonPedro;
        Button werewolf_button;
        Button buttonCelso;
        Button jonathanButton;
        Button buttonAna;
        Button fernandaButton;
        Button buttonBielrock;
        Button amandaButton;
        Button buttonJoao;
        Button buttonJack;
        Button buttonCaio;

        public Song musica;

        Texture2D backGround;

        private int stageSelectW = 250;
        private int stageSelectH = 120;

        public Menu(ContentManager Content, GameWindow Window)
        {
            //backGround = Content.Load<Texture2D>("MENU/backgroundMenu");

            musica = Content.Load<Song>("MENU/Musica");
           
            //MediaPlayer.Play(musica);

            MediaPlayer.Volume = 0.2f;

            buttonJack = new Button(
                Content.Load<Texture2D>(@"LEVEL_JACK/Spike"),
                new Vector2(10+ 0 * stageSelectW,0 * stageSelectH),
                "Space JACK",
                Game1.State.LEVEL_JACK,
                false,
                 Content.Load<Texture2D>("MENU/ImagemColisao"));

            buttonGabe = new Button(
                Content.Load<Texture2D>("LEVEL_GABE/buttonAWESOME"),
                 new Vector2(10 + 0 * stageSelectW, 1 * stageSelectH),
                "vai pro gabe õ/",
                Game1.State.LEVEL_GABE,
                false,
                 Content.Load<Texture2D>("MENU/ImagemColisao"));
                 //Content.Load<SoundEffect>("MENU/SomDoBotao"));
            
            buttonDiehl = new Button(
                Content.Load<Texture2D>("LEVEL_DIEHL/buttonMega"),
                new Vector2(10 + 0 * stageSelectW, 2 * stageSelectH),
                "vai pro diehl",
                Game1.State.LEVEL_DIEHL,
                false,
                 Content.Load<Texture2D>("MENU/ImagemColisao"));

            buttonAdilio = new Button(
                Content.Load<Texture2D>("LEVEL_ADILIO/icon"),
                 new Vector2(10 + 0 * stageSelectW, 3 * stageSelectH),
                "vai pro adilio",
                Game1.State.LEVEL_ADILIO,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"));
            
            buttonPedro = new Button(
                Content.Load<Texture2D>("LEVEL_PEDRO/botaoPedroAtual"),
                new Vector2(10 + 0 * stageSelectW, 4 * stageSelectH),
                "Vai pro Pedro",
                Game1.State.LEVEL_PEDRO,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"));

            werewolf_button = new Button(
                Content.Load<Texture2D>("LEVEL_VINICIUS/werewolf_button"),
                new Vector2(10 + 1 * stageSelectW, 0 * stageSelectH),
                "Vai pro Vinicius",
                Game1.State.LEVEL_VINICIUS,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            buttonCelso = new Button(
               Content.Load<Texture2D>("LEVEL_CELSO/buttonCelso"),
               new Vector2(10 + 1 * stageSelectW, 1 * stageSelectH),
               "Vai pro Celso *-*",
               Game1.State.LEVEL_CELSO,
               false,
               Content.Load<Texture2D>("MENU/ImagemColisao"),
               Content.Load<SoundEffect>("MENU/SomDoBotao"));

            jonathanButton = new Button(
                Content.Load<Texture2D>("LEVEL_JONATHAN/button"),
                new Vector2(10 + 1 * stageSelectW, 2 * stageSelectH),
                "vai pro Jonathan",
                Game1.State.LEVEL_JONATHAN,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            buttonAna = new Button(
                Content.Load<Texture2D>("LEVEL_ANA/anabotao"),
                new Vector2(10 + 1 * stageSelectW, 3 * stageSelectH), 
                "vai pra Ana",
                Game1.State.LEVEL_ANA,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));


            fernandaButton = new Button(
                Content.Load<Texture2D>("LEVEL_FERNANDA/Games"),
                new Vector2(10 + 1 * stageSelectW, 4 * stageSelectH),
                "vai pra Fernanda",
                Game1.State.LEVEL_FERNANDA,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            amandaButton = new Button(
                Content.Load<Texture2D>("LEVEL_AMANDA/amanda_botao"),
                new Vector2(10 + 2 * stageSelectW, 0 * stageSelectH),
                "Vai pra Amanda",
                Game1.State.LEVEL_AMANDA,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            buttonJoao = new Button(
                Content.Load<Texture2D>("LEVEL_JOAO/OK"),
                new Vector2(10 + 2 * stageSelectW, 1 * stageSelectH),
                "vai pro João",
                Game1.State.LEVEL_JOAO,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            buttonBielrock = new Button(
                Content.Load<Texture2D>("LEVEL_BIELROCK/icon"),
                new Vector2(10 + 2 * stageSelectW, 2 * stageSelectH),
                "vai pro BielRock",
                Game1.State.LEVEL_BIELROCK,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

            buttonCaio = new Button(
                Content.Load<Texture2D>("LEVEL_CAIO/buttonNave"),
                new Vector2(10 + 2 * stageSelectW, 3 * stageSelectH),
                "Vai Pro Caio",
                Game1.State.LEVEL_CAIOZ,
                false,
                Content.Load<Texture2D>("MENU/ImagemColisao"),
                Content.Load<SoundEffect>("MENU/SomDoBotao"));

        }

        public void Update(GameTime gameTime, KeyboardState ks)
        {
            buttonGabe.Update(gameTime);
            buttonDiehl.Update(gameTime);
            buttonAdilio.Update(gameTime);
            buttonPedro.Update(gameTime);
            werewolf_button.Update(gameTime);
            buttonCelso.Update(gameTime);
            jonathanButton.Update(gameTime);
            buttonAna.Update(gameTime);
            fernandaButton.Update(gameTime);
            buttonBielrock.Update(gameTime);
            amandaButton.Update(gameTime);
            buttonJoao.Update(gameTime);
            buttonJack.Update(gameTime);
            buttonCaio.Update(gameTime);
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
           // spriteBatch.Draw(backGround, new Vector2( 0, 0), Color.White);

            buttonGabe.Draw(gameTime, spriteBatch);
            buttonDiehl.Draw(gameTime, spriteBatch);
            buttonAdilio.Draw(gameTime, spriteBatch);
            buttonPedro.Draw(gameTime, spriteBatch);
            werewolf_button.Draw(gameTime, spriteBatch);
            buttonCelso.Draw(gameTime, spriteBatch);
            jonathanButton.Draw(gameTime, spriteBatch);
            buttonAna.Draw(gameTime, spriteBatch);
            fernandaButton.Draw(gameTime, spriteBatch);
            amandaButton.Draw(gameTime, spriteBatch);
            buttonJoao.Draw(gameTime, spriteBatch);
            buttonJack.Draw(gameTime, spriteBatch);
            buttonBielrock.Draw(gameTime, spriteBatch);
            buttonCaio.Draw(gameTime, spriteBatch);
        }
    }
}